<template>
  <el-tabs
    type="border-card"
    style="margin: 0 20px; height: 93vh"
    @tab-click="tabChange"
    v-model="$store.state.activeName2"
  >
    <el-tab-pane label="单点变形分析" name="单点变形分析">
      <el-form inline :model="form">
        <el-form-item label="参考系类型">
          <el-select v-model="form.referenceName" size="mini">
            <el-option label="WGS84" value="WGS84"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="datetime"
            placeholder="选择开始时间"
            size="mini"
            v-model="form.startTime"
            default-time="00:00:00"
            :picker-options="startTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="datetime"
            placeholder="选择结束时间"
            size="mini"
            v-model="form.endTime"
            default-time="00:00:00"
            :picker-options="endTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="统计时间类型">
          <el-select v-model="form.timeType" size="mini">
            <el-option label="每24小时" value="24"></el-option>
            <el-option label="每12小时" value="12"></el-option>
            <el-option label="每6小时" value="6"></el-option>
            <el-option label="每2小时" value="2"></el-option>
            <el-option label="每1小时" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="search">查询</el-button>
        </el-form-item>
      </el-form>
      <div id="single" class="chart"></div>
    </el-tab-pane>
    <el-tab-pane label="静态数据分析" name="静态数据分析">
      <el-form inline :model="form2">
        <el-form-item label="开始时间">
          <el-date-picker
            type="datetime"
            placeholder="选择开始时间"
            size="mini"
            v-model="form2.startTime"
            default-time="00:00:00"
            :picker-options="startTimePicker2"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="datetime"
            placeholder="选择结束时间"
            size="mini"
            v-model="form2.endTime"
            default-time="00:00:00"
            :picker-options="endTimePicker2"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="search2">查询</el-button>
        </el-form-item>
      </el-form>
      <div id="static" class="chart"></div>
    </el-tab-pane>
    <el-tab-pane label="单点变形速率分析" name="单点变形速率分析">
      <el-form inline :model="form3">
        <el-form-item label="参考系类型">
          <el-select v-model="form3.referenceName" size="mini">
            <el-option label="WGS84" value="WGS84"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="datetime"
            placeholder="选择开始时间"
            size="mini"
            v-model="form3.startTime"
            default-time="00:00:00"
            :picker-options="startTimePicker3"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="datetime"
            placeholder="选择结束时间"
            size="mini"
            v-model="form3.endTime"
            default-time="00:00:00"
            :picker-options="endTimePicker3"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="统计时间类型">
          <el-select v-model="form3.timeType" size="mini">
            <el-option label="每24小时" value="24"></el-option>
            <el-option label="每12小时" value="12"></el-option>
            <el-option label="每6小时" value="6"></el-option>
            <el-option label="每2小时" value="2"></el-option>
            <el-option label="每1小时" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="search3">查询</el-button>
        </el-form-item>
      </el-form>
      <div id="speed" class="chart"></div>
    </el-tab-pane>
    <el-tab-pane label="累计变形分析" name="累计变形分析">
      <el-form inline :model="form4">
        <el-form-item label="参考系类型">
          <el-select v-model="form4.referenceName" size="mini">
            <el-option label="WGS84" value="WGS84"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="datetime"
            placeholder="选择开始时间"
            size="mini"
            v-model="form4.startTime"
            default-time="00:00:00"
            :picker-options="startTimePicker4"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="datetime"
            placeholder="选择结束时间"
            size="mini"
            v-model="form4.endTime"
            default-time="00:00:00"
            :picker-options="endTimePicker4"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="search4">查询</el-button>
        </el-form-item>
      </el-form>
      <div id="total" class="chart"></div>
    </el-tab-pane>
    <el-tab-pane label="GNSS反演可降水量" name="GNSS反演可降水量">
      <el-form inline :model="form5">
        <el-form-item label="开始时间">
          <el-date-picker
            type="datetime"
            placeholder="选择开始时间"
            size="mini"
            v-model="form5.startTime"
            default-time="00:00:00"
            :picker-options="startTimePicker5"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="datetime"
            placeholder="选择结束时间"
            size="mini"
            v-model="form5.endTime"
            default-time="00:00:00"
            :picker-options="endTimePicker5"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="search5">查询</el-button>
        </el-form-item>
      </el-form>
      <div id="gnss" class="chart"></div>
    </el-tab-pane>
  </el-tabs>
</template>

<script>
import Axios from "axios";
import moment from "moment";
import * as serviceApi from "../../../common/service.config";
Axios.defaults.withcredentials = true;

export default {
  inject: ["reload"],
  name: "BeiDouChart",
  props: {
    node: Object,
  },
  data() {
    return {
      form: {
        referenceName: "WGS84",
        timeType: "24",
        startTime: null,
        endTime: moment().format("YYYY-MM-DD 00:00:00"),
        minTime: null,
      },
      form2: {
        startTime: null,
        endTime: moment().format("YYYY-MM-DD 00:00:00"),
        minTime: null,
      },
      form3: {
        referenceName: "WGS84",
        timeType: "24",
        startTime: null,
        endTime: moment().format("YYYY-MM-DD 00:00:00"),
        minTime: null,
      },
      form4: {
        referenceName: "WGS84",
        startTime: null,
        endTime: moment().format("YYYY-MM-DD 00:00:00"),
        minTime: null,
      },
      form5: {
        startTime: null,
        endTime: moment().format("YYYY-MM-DD 00:00:00"),
        minTime: null,
      },
      singlePointChart: null,
      staticChart: null,
      speedChart: null,
      totalChart: null,
      moistureChart: null,
    };
  },
  computed: {
    startTimePicker() {
      return {
        disabledDate: (time) =>
          this.form.startTime
            ? time.getTime() < new Date(this.form.minTime).getTime() ||
              time.getTime() > new Date(this.form.endTime).getTime()
            : false,
      };
    },
    endTimePicker() {
      return {
        disabledDate: (time) =>
          this.form.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form.startTime).getTime()
            : false,
      };
    },
    startTimePicker2() {
      return {
        disabledDate: (time) =>
          this.form2.startTime
            ? time.getTime() < new Date(this.form2.minTime).getTime() ||
              time.getTime() > new Date(this.form2.endTime).getTime()
            : false,
      };
    },
    endTimePicker2() {
      return {
        disabledDate: (time) =>
          this.form2.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form2.startTime).getTime()
            : false,
      };
    },
    startTimePicker3() {
      return {
        disabledDate: (time) =>
          this.form3.startTime
            ? time.getTime() < new Date(this.form3.minTime).getTime() ||
              time.getTime() > new Date(this.form3.endTime).getTime()
            : false,
      };
    },
    endTimePicker3() {
      return {
        disabledDate: (time) =>
          this.form3.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form3.startTime).getTime()
            : false,
      };
    },
    startTimePicker4() {
      return {
        disabledDate: (time) =>
          this.form4.startTime
            ? time.getTime() < new Date(this.form4.minTime).getTime() ||
              time.getTime() > new Date(this.form4.endTime).getTime()
            : false,
      };
    },
    endTimePicker4() {
      return {
        disabledDate: (time) =>
          this.form4.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form4.startTime).getTime()
            : false,
      };
    },
    startTimePicker5() {
      return {
        disabledDate: (time) =>
          this.form5.startTime
            ? time.getTime() < new Date(this.form5.minTime).getTime() ||
              time.getTime() > new Date(this.form5.endTime).getTime()
            : false,
      };
    },
    endTimePicker5() {
      return {
        disabledDate: (time) =>
          this.form5.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form5.startTime).getTime()
            : false,
      };
    },
  },
  methods: {
    tabChange(tab) {
      this.$store.dispatch("getTabName2", tab.paneName);
    },
    SinglePointAnalysis(queryData, list, sensorName) {
      let xdata = [],
        ydata = [],
        hdata = [],
        pdata = [],
        theDate = [];
      for (let j = 0; j < list.length; j++) {
        xdata.push((list[j].xdata * 1000).toFixed(1));
        ydata.push((list[j].ydata * 1000).toFixed(1));
        hdata.push((list[j].hdata * 1000).toFixed(1));
        pdata.push((list[j].pdata * 1000).toFixed(1));
        theDate.push(moment(list[j].theDate / 1).format("YYYY-MM-DD HH:mm:ss"));
      }
      let chartOption = {
        title: {
          text:
            sensorName +
            "站点" +
            queryData.startTime +
            "至" +
            queryData.endTime +
            "内单点变形分析（" +
            queryData.referenceName +
            "）",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          top: 30,
          data: ["x平移", "y平移", "H位移", "平面位移"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
          right: "5%",
        },
        xAxis: {
          name: "时间",
          type: "category",
          boundaryGap: false,
          data: theDate,
        },
        yAxis: {
          name: "位移(mm)",
          type: "value",
          // axisLabel: {
          //     formatter: '{value} mm'
          // }
        },
        color: [
          "#027602",
          "#0101F6",
          "#840284",
          "#FF0000",
          "#27727B",
          "#FE8463",
          "#9BCA63",
          "#FAD860",
          "#F3A43B",
          "#60C0DD",
          "#D7504B",
          "#C6E579",
          "#F4E001",
          "#F0805A",
          "#26C0C0",
        ],
        series: [
          {
            name: "x平移",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            markLine: {
              silent: true,
              data: [{ yAxis: 20 }, { yAxis: -20 }],
            },
            data: xdata,
          },
          {
            name: "y平移",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            markLine: {
              silent: true,
              data: [{ yAxis: 20 }, { yAxis: -20 }],
            },
            data: ydata,
          },
          {
            name: "H位移",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            markLine: {
              silent: true,
              data: [{ yAxis: 50 }, { yAxis: -50 }],
            },
            data: hdata,
          },
          {
            name: "平面位移",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            markLine: {
              silent: true,
              data: [{ yAxis: 28 }, { yAxis: -28 }],
            },
            data: pdata,
          },
        ],
      };
      this.singlePointChart.clear();
      this.singlePointChart.setOption(chartOption);
      this.singlePointChart.resize();
    },
    StaticData(list, firstData, sensorName, queryData) {
      let xData = [],
        yData = [],
        hData = [],
        theDate = [];
      for (let j = 0; j < list.length; j++) {
        if (
          list[j].stdx >= 50.0 ||
          list[j].stdy >= 50.0 ||
          list[j].stdh >= 50.0 ||
          list[j].stdl >= 50.0
        ) {
          continue;
        }
        xData.push(((list[j].dataGx - firstData.dataGx) * 1000).toFixed(1));
        yData.push(((list[j].dataGy - firstData.dataGy) * 1000).toFixed(1));
        hData.push(((list[j].dataH - firstData.dataH) * 1000).toFixed(1));
        theDate.push(moment(list[j].theDate).format("YYYY-MM-DD HH:mm:ss"));
      }
      let chartOption = {
        title: {
          text:
            sensorName +
            " 站点" +
            queryData.startTime +
            " 到 " +
            queryData.endTime +
            " 内静态数据分析",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          top: 30,
          data: ["Δx", "Δy", "ΔH"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
          right: "5%",
        },
        xAxis: {
          name: "时间",
          type: "category",
          boundaryGap: false,
          data: theDate,
        },
        yAxis: {
          name: "单位(mm)",
          type: "value",
          // axisLabel: {
          //     formatter: '{value} mm'
          // }
        },
        color: [
          "#027602",
          "#0101F6",
          "#840284",
          "#FF0000",
          "#27727B",
          "#FE8463",
          "#9BCA63",
          "#FAD860",
          "#F3A43B",
          "#60C0DD",
          "#D7504B",
          "#C6E579",
          "#F4E001",
          "#F0805A",
          "#26C0C0",
        ],
        series: [
          {
            name: "Δx",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: xData,
          },
          {
            name: "Δy",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: yData,
          },
          {
            name: "ΔH",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: hData,
          },
        ],
      };
      this.staticChart.clear();
      this.staticChart.setOption(chartOption);
      this.staticChart.resize();
    },
    SpeedAnalysis(queryData, list, sensorName) {
      let xdata = [],
        ydata = [],
        hdata = [],
        theDate = [];
      for (let j = 0; j < list.length; j++) {
        xdata.push((list[j].xspeed * 1000).toFixed(1));
        ydata.push((list[j].yspeed * 1000).toFixed(1));
        hdata.push((list[j].hspeed * 1000).toFixed(1));
        theDate.push(moment(list[j].theDate / 1).format("YYYY-MM-DD HH:mm:ss"));
      }
      let chartOption = {
        title: {
          text:
            sensorName +
            "站点" +
            queryData.startTime +
            "至" +
            queryData.endTime +
            "内单点变形速率分析（" +
            queryData.referenceName +
            "）",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          top: 30,
          data: ["x平移速率", "y平移速率", "H位移速率"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
          right: "5%",
        },
        xAxis: {
          name: "时间",
          type: "category",
          boundaryGap: false,
          data: theDate,
        },
        yAxis: {
          name: "位移（mm）",
          type: "value",
          // axisLabel: {
          //     formatter: '{value} mm'
          // }
        },
        color: [
          "#027602",
          "#0101F6",
          "#840284",
          "#FF0000",
          "#27727B",
          "#FE8463",
          "#9BCA63",
          "#FAD860",
          "#F3A43B",
          "#60C0DD",
          "#D7504B",
          "#C6E579",
          "#F4E001",
          "#F0805A",
          "#26C0C0",
        ],
        series: [
          {
            name: "x平移速率",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: xdata,
          },
          {
            name: "y平移速率",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: ydata,
          },
          {
            name: "H位移速率",
            type: "line",
            smooth: true,
            lineStyle: {
              normal: {
                width: 3,
              },
            },
            data: hdata,
          },
        ],
      };
      this.speedChart.clear();
      this.speedChart.setOption(chartOption);
      this.speedChart.resize();
    },
    TotalAnalysis(queryData, parameter) {
      let xdata = [],
        ydata = [],
        hdata = [],
        sensorName = [];
      for (let j = 0; j < parameter.length; j++) {
        xdata.push((parameter[j].gxData * 1000).toFixed(1));
        ydata.push((parameter[j].gyData * 1000).toFixed(1));
        hdata.push((parameter[j].hData * 1000).toFixed(1));
        let sensor = parameter[j].sensorName.trim("#", "left");
        sensorName.push(sensor);
      }
      let chartOption = {
        title: {
          text: "北斗站点累计变形分析（" + queryData.referenceName + "）",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        legend: {
          top: 30,
          data: ["x平移", "y平移", "H位移"],
        },
        grid: {
          left: "20%",
          right: "20%",
          bottom: "5%",
          containLabel: true,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
          right: "5%",
        },
        xAxis: {
          type: "category",
          boundaryGap: true,
          data: sensorName,
          textStyle: {
            fontSize: 10,
          },
          axisLabel: {
            //坐标轴刻度标签的相关设置。
            interval: 0,
            rotate: "10",
          },
        },
        yAxis: {
          type: "value",
          name: "位移(mm)",
          nameLocation: "end",
          // axisLabel: {
          //     formatter: '{value} mm'
          // }
        },
        color: ["#018200", "#0200FE", "#81007F"],
        series: [
          {
            name: "x平移",
            type: "bar",
            width: "2",
            barGap: 0,
            data: xdata,
            markLine: {
              silent: true,
              data: [{ yAxis: 45 }, { yAxis: -45 }],
            },
          },
          {
            name: "y平移",
            type: "bar",
            width: "2",
            data: ydata,
            markLine: {
              silent: true,
              data: [{ yAxis: 45 }, { yAxis: -45 }],
            },
          },
          {
            name: "H位移",
            type: "bar",
            width: "2",
            data: hdata,
            markLine: {
              silent: true,
              data: [{ yAxis: 45 }, { yAxis: -45 }],
            },
          },
        ],
      };
      this.totalChart.clear();
      this.totalChart.setOption(chartOption);
      this.totalChart.resize();
    },
    MoistureInversion(xData, yData) {
      let text = "GNSS反演可降水量";
      var option = {
        title: {
          text: text,
          left: "center",
        },
        color: ["#3398DB"],
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
          formatter: "{b0}<br />{a}&nbsp;:&nbsp;{c0}mm",
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            axisLine: {
              onZero: false,
            },
            type: "category",
            data: xData,
            axisTick: {
              alignWithLabel: true,
            },
          },
        ],
        yAxis: [
          {
            name: "PWV(mm)",
            nameLocation: "end",
            type: "value",
            inverse: false,
            nameGap: 30,
            // axisLabel: {
            //     formatter: 'PWV {value} mm'
            // }
          },
        ],
        series: [
          {
            name: "pwv",
            type: "bar",
            data: yData,
          },
        ],
      };
      this.moistureChart.clear();
      this.moistureChart.setOption(option);
      this.moistureChart.resize();
    },
    search() {
      let queryData = {
        startTime: moment(this.form.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form.endTime).format("YYYY-MM-DD"),
        referenceName: this.form.referenceName,
        timeType: this.form.timeType,
      };
      sessionStorage.setItem("startTime", queryData.startTime);
      sessionStorage.setItem("endTime", queryData.endTime);
      sessionStorage.setItem("timeType", queryData.timeType);
      this.reload();
    },
    search2() {
      let queryData = {
        startTime: moment(this.form2.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form2.endTime).format("YYYY-MM-DD"),
      };
      sessionStorage.setItem("startTime", queryData.startTime);
      sessionStorage.setItem("endTime", queryData.endTime);
      this.reload();
    },
    search3() {
      let queryData = {
        startTime: moment(this.form3.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form3.endTime).format("YYYY-MM-DD"),
        referenceName: this.form3.referenceName,
        timeType: this.form3.timeType,
      };
      sessionStorage.setItem("startTime", queryData.startTime);
      sessionStorage.setItem("endTime", queryData.endTime);
      sessionStorage.setItem("timeType", queryData.timeType);
      this.reload();
    },
    search4() {
      let queryData = {
        startTime: moment(this.form4.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form4.endTime).format("YYYY-MM-DD"),
        referenceName: this.form4.referenceName,
      };
      sessionStorage.setItem("startTime", queryData.startTime);
      sessionStorage.setItem("endTime", queryData.endTime);
      this.reload();
    },
    search5() {
      let queryData = {
        startTime: moment(this.form5.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form5.endTime).format("YYYY-MM-DD"),
      };
      sessionStorage.setItem("startTime", queryData.startTime);
      sessionStorage.setItem("endTime", queryData.endTime);
      this.reload();
    },
  },
  mounted() {
    this.singlePointChart = this.$echarts.init(
      document.getElementById("single")
    );
    this.staticChart = this.$echarts.init(document.getElementById("static"));
    this.speedChart = this.$echarts.init(document.getElementById("speed"));
    this.totalChart = this.$echarts.init(document.getElementById("total"));
    this.moistureChart = this.$echarts.init(document.getElementById("gnss"));
    let fun = () => {
      this.singlePointChart.showLoading();
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"01\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        let startTime = res.data.parameter.startTime;
        this.form.minTime = moment(startTime).format("YYYY-MM-DD 00:00:00");
        let queryData = {
          startTime: startTime,
          endTime: moment().format("YYYY-MM-DD"),
          referenceName: "WGS84",
          timeType: "24",
        };
        if (sessionStorage.getItem("startTime"))
          queryData.startTime = sessionStorage.getItem("startTime");
        if (sessionStorage.getItem("endTime"))
          queryData.endTime = sessionStorage.getItem("endTime");
        if (sessionStorage.getItem("timeType"))
          queryData.timeType = sessionStorage.getItem("timeType");
        this.form.startTime = moment(queryData.startTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form.endTime = moment(queryData.endTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form.timeType = queryData.timeType;
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"referenceName\\":\\"${
            this.form.referenceName
          }\\",\\"referenceType\\":\\"default\\",\\"sensorNumber\\":\\"${
            this.node.sensorNumber
          }\\",\\"startTime\\":\\"${
            queryData.startTime
          }\\",\\"endTime\\":\\"${moment().format(
            "YYYY-MM-DD"
          )}\\",\\"timeType\\":\\"${
            queryData.timeType
          }\\"}","serviceCode":"planeAnalysis","timestamp":"","uuid":""}`,
        }).then((res) => {
          let list = res.data.parameter.list;
          this.singlePointChart.hideLoading();
          this.SinglePointAnalysis(queryData, list, this.node.label);
        });
      });
    };
    let fun2 = () => {
      this.staticChart.showLoading();
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"03\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        let startTime = res.data.parameter.startTime;
        this.form2.minTime = moment(startTime).format("YYYY-MM-DD 00:00:00");
        let queryData = {
          startTime: startTime,
          endTime: moment().format("YYYY-MM-DD"),
        };
        if (sessionStorage.getItem("startTime"))
          queryData.startTime = sessionStorage.getItem("startTime");
        if (sessionStorage.getItem("endTime"))
          queryData.endTime = sessionStorage.getItem("endTime");
        this.form2.startTime = moment(queryData.startTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form2.endTime = moment(queryData.endTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"orderBy\\":\\"asc\\"}","serviceCode":"queryBeiDouStatic","timestamp":"","uuid":""}`,
        }).then((res) => {
          let list = res.data.parameter.list;
          let firstData;
          if (!res.data.parameter.firstDmo) {
            firstData = "";
          } else {
            firstData = res.data.parameter.firstDmo;
          }
          this.staticChart.hideLoading();
          this.StaticData(list, firstData, this.node.label, queryData);
        });
      });
    };
    let fun3 = () => {
      this.speedChart.showLoading();
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"01\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        let startTime = res.data.parameter.startTime;
        this.form3.minTime = moment(startTime).format("YYYY-MM-DD 00:00:00");
        let queryData = {
          startTime: startTime,
          endTime: moment().format("YYYY-MM-DD"),
          referenceName: "WGS84",
          timeType: "24",
        };
        if (sessionStorage.getItem("startTime"))
          queryData.startTime = sessionStorage.getItem("startTime");
        if (sessionStorage.getItem("endTime"))
          queryData.endTime = sessionStorage.getItem("endTime");
        if (sessionStorage.getItem("timeType"))
          queryData.timeType = sessionStorage.getItem("timeType");
        this.form3.startTime = moment(queryData.startTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form3.endTime = moment(queryData.endTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form3.timeType = queryData.timeType;
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"referenceName\\":\\"${queryData.referenceName}\\",\\"referenceType\\":\\"default\\",\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"timeType\\":\\"${queryData.timeType}\\"}","serviceCode":"planeAnalysis","timestamp":"","uuid":""}`,
        }).then((res) => {
          let list = res.data.parameter.list;
          this.speedChart.hideLoading();
          this.SpeedAnalysis(queryData, list, this.node.label);
        });
      });
    };
    let fun4 = () => {
      this.totalChart.showLoading();
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"01\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        let startTime = res.data.parameter.startTime;
        this.form4.minTime = moment(startTime).format("YYYY-MM-DD 00:00:00");
        let queryData = {
          startTime: startTime,
          endTime: moment().format("YYYY-MM-DD"),
          referenceName: "WGS84",
        };
        if (sessionStorage.getItem("startTime"))
          queryData.startTime = sessionStorage.getItem("startTime");
        if (sessionStorage.getItem("endTime"))
          queryData.endTime = sessionStorage.getItem("endTime");
        this.form4.startTime = moment(queryData.startTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form4.endTime = moment(queryData.endTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"monitorId\\":\\"${this.node.monitorId}\\",\\"referenceName\\":\\"${queryData.referenceName}\\",\\"referenceType\\":\\"default\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\"}","serviceCode":"queryTotalBD","timestamp":"","uuid":""}`,
        }).then((res) => {
          let parameter = res.data.parameter;
          this.totalChart.hideLoading();
          this.TotalAnalysis(queryData, parameter);
        });
      });
    };
    let fun5 = () => {
      this.moistureChart.showLoading();
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"02\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        let startTime = res.data.parameter.startTime;
        this.form5.minTime = moment(startTime).format("YYYY-MM-DD 00:00:00");
        let queryData = {
          startTime: startTime,
          endTime: moment().format("YYYY-MM-DD"),
        };
        if (sessionStorage.getItem("startTime"))
          queryData.startTime = sessionStorage.getItem("startTime");
        if (sessionStorage.getItem("endTime"))
          queryData.endTime = sessionStorage.getItem("endTime");
        this.form5.startTime = moment(queryData.startTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        this.form5.endTime = moment(queryData.endTime).format(
          "YYYY-MM-DD 00:00:00"
        );
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\"}","serviceCode":"listMoistureInversion","timestamp":"","uuid":""}`,
        }).then((res) => {
          let list = res.data.parameter.list;
          this.moistureChart.hideLoading();
          this.MoistureInversion("", "");
        });
      });
    };
    let DataAnalysis = async () => {
      await fun();
      await fun2();
      await fun3();
      await fun4();
      await fun5();
    };
    DataAnalysis();
  },
};
</script>

<style lang="less" scoped>
.chart {
  width: 1600px;
  height: 75vh;
}
</style>